package com.ruoyi.service.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.service.mapper.CheMessageMapper;
import com.ruoyi.service.domain.CheMessage;
import com.ruoyi.service.service.ICheMessageService;

/**
 * 消息，记录系统发送给用户的各类消息Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-01-09
 */
@Service
public class CheMessageServiceImpl implements ICheMessageService 
{
    @Autowired
    private CheMessageMapper cheMessageMapper;

    /**
     * 查询消息，记录系统发送给用户的各类消息
     * 
     * @param id 消息，记录系统发送给用户的各类消息主键
     * @return 消息，记录系统发送给用户的各类消息
     */
    @Override
    public CheMessage selectCheMessageById(Long id)
    {
        return cheMessageMapper.selectCheMessageById(id);
    }

    /**
     * 查询消息，记录系统发送给用户的各类消息列表
     * 
     * @param cheMessage 消息，记录系统发送给用户的各类消息
     * @return 消息，记录系统发送给用户的各类消息
     */
    @Override
    public List<CheMessage> selectCheMessageList(CheMessage cheMessage)
    {
        return cheMessageMapper.selectCheMessageList(cheMessage);
    }

    /**
     * 新增消息，记录系统发送给用户的各类消息
     * 
     * @param cheMessage 消息，记录系统发送给用户的各类消息
     * @return 结果
     */
    @Override
    public int insertCheMessage(CheMessage cheMessage)
    {
        cheMessage.setCreateTime(DateUtils.getNowDate());
        return cheMessageMapper.insertCheMessage(cheMessage);
    }

    /**
     * 修改消息，记录系统发送给用户的各类消息
     * 
     * @param cheMessage 消息，记录系统发送给用户的各类消息
     * @return 结果
     */
    @Override
    public int updateCheMessage(CheMessage cheMessage)
    {
        return cheMessageMapper.updateCheMessage(cheMessage);
    }

    /**
     * 批量删除消息，记录系统发送给用户的各类消息
     * 
     * @param ids 需要删除的消息，记录系统发送给用户的各类消息主键
     * @return 结果
     */
    @Override
    public int deleteCheMessageByIds(Long[] ids)
    {
        return cheMessageMapper.deleteCheMessageByIds(ids);
    }

    /**
     * 删除消息，记录系统发送给用户的各类消息信息
     * 
     * @param id 消息，记录系统发送给用户的各类消息主键
     * @return 结果
     */
    @Override
    public int deleteCheMessageById(Long id)
    {
        return cheMessageMapper.deleteCheMessageById(id);
    }

    @Override
    public List<CheMessage> selectCheMessageByUserId(Long userId) {
        List<CheMessage> cheMessages = cheMessageMapper.selectCheMessageByUserId(userId);
        return cheMessages;
    }
}
